package com.lk.ii.service.impl;

import java.util.List;
import com.lk.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.lk.ii.mapper.IiMaterialMapper;
import com.lk.ii.domain.IiMaterial;
import com.lk.ii.service.IIiMaterialService;
import com.lk.common.core.text.Convert;

/**
 * 素材Service业务层处理
 * 
 * @author lk
 * @date 2021-02-04
 */
@Service
public class IiMaterialServiceImpl implements IIiMaterialService 
{
    @Autowired
    private IiMaterialMapper iiMaterialMapper;

    /**
     * 查询素材
     * 
     * @param id 素材ID
     * @return 素材
     */
    @Override
    public IiMaterial selectIiMaterialById(Long id)
    {
        return iiMaterialMapper.selectIiMaterialById(id);
    }

    /**
     * 查询素材列表
     * 
     * @param iiMaterial 素材
     * @return 素材
     */
    @Override
    public List<IiMaterial> selectIiMaterialList(IiMaterial iiMaterial)
    {
        return iiMaterialMapper.selectIiMaterialList(iiMaterial);
    }

    /**
     * 新增素材
     * 
     * @param iiMaterial 素材
     * @return 结果
     */
    @Override
    public int insertIiMaterial(IiMaterial iiMaterial)
    {
        iiMaterial.setCreateTime(DateUtils.getNowDate());
        return iiMaterialMapper.insertIiMaterial(iiMaterial);
    }

    /**
     * 修改素材
     * 
     * @param iiMaterial 素材
     * @return 结果
     */
    @Override
    public int updateIiMaterial(IiMaterial iiMaterial)
    {
        iiMaterial.setUpdateTime(DateUtils.getNowDate());
        return iiMaterialMapper.updateIiMaterial(iiMaterial);
    }

    /**
     * 删除素材对象
     * 
     * @param ids 需要删除的数据ID
     * @return 结果
     */
    @Override
    public int deleteIiMaterialByIds(String ids)
    {
        return iiMaterialMapper.deleteIiMaterialByIds(Convert.toStrArray(ids));
    }

    /**
     * 删除素材信息
     * 
     * @param id 素材ID
     * @return 结果
     */
    @Override
    public int deleteIiMaterialById(Long id)
    {
        return iiMaterialMapper.deleteIiMaterialById(id);
    }
}
